﻿
/*----------------------------------------------------------------
 * 创建时间：2023/7/21 18:02:43
 * 作  者：wenlli 
 * 项  目：Minotaur.App.Modules.FlowProcess.ViewModels 
 * 描  述：
 *
 * ----------------------------------------------------------------
 * 修改人：
 * 时  间：
 * 修改说明：
 * 
 *----------------------------------------------------------------*/


using Mapster;
using Minotaur.App.Core;
using Minotaur.App.Core.Mvvm;
using Minotaur.App.Core.Redis;
using Minotaur.App.Domains.Dto;
using Prism.Commands;
using Prism.Regions;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Input;

namespace Minotaur.App.Modules.FlowProcess.ViewModels
{
    public class FowDesignViewModel : WindowComputeViewModel
    {
        private readonly GlobalUserModel globalUserModel;
        public FowDesignViewModel(IRegionManager regionManager, IDbContext dbContext, IRedisClient _redisClient, GlobalUserModel globalUserModel) : base(regionManager, dbContext, _redisClient)
        {
            this.globalUserModel = globalUserModel;
        } 
        public ObservableCollection<MenuInfoDto> _MenuInfos = new ObservableCollection<MenuInfoDto>();
        public ObservableCollection<MenuInfoDto> MenuInfos { get => _MenuInfos; set => SetProperty(ref _MenuInfos, value); }

        /// <summary>
        /// 新增流程
        /// </summary>
        public ICommand NewFlowCommand => new DelegateCommand(NewFlowAction);

        private void NewFlowAction()
        {
            RegionManager?.RequestNavigate(RegionNames.ContentRegion, "processdesign");
        }

        public override void InitData()
        {
            this.MenuInfos = globalUserModel.MenuInfos.Adapt<ObservableCollection<MenuInfoDto>>();
        }
    }
}
